{% extends 'Shared/layout.volt' %}
{% block title %}分组列表{% endblock %}
{% block content %}
    <section class="Hui-article-box">
        <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i>
            <a href="/" title="首页">首页</a>
            <span class="c-gray en">&gt;</span>
            开放API
            <span class="c-gray en">&gt;</span>
            分组管理
            <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a> </nav>
        <div class="Hui-article">
            <article class="cl pd-20">

                <div class="cl pd-5 bg-1 bk-gray mt-20">
                    <span class="l">
                        <a href="{{ url('group/edit') }}" id="add-group-button" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加分组</a>
                    </span>
                </div>
                <table class="table table-border table-bordered table-bg">
                    <thead>
                    <tr class="text-c">
                        <th width="200">分组</th>
                        <th width="300">编号</th>
                        <th width="100">状态</th>
                        <th width="200">添加时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for group in Model.items %}
                    <tr class="text-c">
                        <td><a href="{{ url('group/detail/' ~ group.group_code) }}">{{ group.group_name }}</a> </td>
                        <td>{{ group.group_code }}</td>
                        <td class="td-status">
                            {% if group.status == 0 %}
                                <span class="label label-success radius">已启用</span>
                            {% else %}
                                <span class="label label-danger radius">已禁用</span>
                            {% endif %}
                        </td>
                        <td>{{ group.create_at }}</td>

                        <td class="td-manage">
                            <a href="{{ url('group/edit/' ~ group.group_code) }}">编辑分组</a> |
                            <a href="{{ url('connector/list?group_code=' ~ group.group_code) }}">API列表</a> |
                            <a href="{{ url('environment/list?group_code=' ~ group.group_code) }}">环境管理</a> |
                            <a href="javascript:;" class="button-group-delete" data-code="{{ group.group_code }}">删除</a>
                        </td>
                    </tr>
                    {% endfor %}
                    </tbody>
                </table>
                <div class="cl pd-5 mt-20 pagination">
                    <?php echo $Model->getPaginate();?>
                </div>
            </article>

        </div>
    </section>
{% endblock %}
{% block scripts %}
<script type="text/javascript">
    $(function () {
        $(".button-group-delete").on('click',function () {
            var group_code = $(this).attr('data-code');

        });
    });
</script>
{% endblock %}